package com.wison;

import org.nutz.http.Http;
import org.nutz.integration.quartz.NutQuartzCronJobFactory;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.json.Json;
import org.nutz.mvc.NutConfig;
import org.nutz.mvc.Setup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2017/3/24.
 */
public class CardSetupBy implements Setup {
    Logger log = LoggerFactory.getLogger(CardSetupBy.class);

    @Inject("java:$conf.get('server_url')")
    String wsdlurl ;

    @Inject("java:$conf.get('dw_id')")
    String dwID;
    @Inject("java:$conf.get('dw_name')")
    String dwNAME;


    @Override
    public void destroy(NutConfig arg0) {

    }

        @Override
        public void init(NutConfig config) {

        config.getIoc().get(NutQuartzCronJobFactory.class);




        //初始化创建单位
        try {
            Map<String, Object> parms = new HashMap();
            Map<String, Object> parm1= new HashMap();
            parm1.put("dw",dwID);
            parm1.put("dwmc",dwNAME);
            parms.put("cards", Json.toJson(parm1));
            String response = Http.post(this.wsdlurl + "/saveBM.do", parms, 50000);
        } catch (Exception e) {
            e.printStackTrace();
        }



    }
}
